import Vue from 'vue'
import Vuex from 'vuex'
import actions from './actions'
import mutations from './mutations'
import report from './report.js'
import cockpit from './cockpit.js'
Vue.use(Vuex);
const state = {
    loading: false, // loading是否显示
    isCollapse: false,
    systemInfo: null, // 系统配置参数
    activeIndex: sessionStorage.getItem('activeIndex'), // 当前选中的菜单
    menuList: JSON.parse(sessionStorage.getItem('menuList')), // 页面菜单
    treeMenu: JSON.parse(sessionStorage.getItem('treeMenu')), // 左侧菜单
    twoChains: JSON.parse(sessionStorage.getItem('twoChains')), // 两链管理静态文件
    reportIndex: [] // 报告所属层面
};

const getters = {
    systemInfo: state => {
        return state.systemInfo;
    },
    activeIndex: state => {
        return state.activeIndex
    },
    menuList: state => {
        return state.menuList
    },
    treeMenu: state => {
        return state.treeMenu
    },
    twoChains: state => {
        return state.twoChains
    }
};

export default new Vuex.Store({
    state,
    getters,
    mutations,
    actions,
    modules: {
        report, // 诊改报告
        cockpit
    }
})
